home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The X-Philes (2nd Revision)
/
The X-Philes Number 1 (1995).iso
/
xphiles
/
hp48hor1
/
hardkeys.doc
< prev
next >
Wrap
Text File
|
1995-03-31
|
13KB
|
246 lines
(Comp.sys.handhelds)
Item: 3767 by ftg0673 at tamsun.TAMU.EDU
Author: [Rick Grevelle]
Subj: HP48 Conference Preview
Date: Thu Jul 25 1991
This is one of the topics I plan to discuss in detail at the up and coming
Handhelds Conference in Corvallis. Since there are those who will not wish
to wait until then to take advantage of this material, it is appropriately
complete to now provide a sneak preview. However the finer details will be
reserved for the conference itself.
Rick Grevelle
ftg0673@tamsun.tamu.edu
(409) 774-1169
===========================================================================
HP48 Hard Key Assignment Interrupts
Normally each time one of the HP48's forty nine keys is pressed two system
binaries are pushed to the stack by the underlying operating system. These
are never seen by the user who is probably unaware that his or her calculator
is using the very same stack for the SYSTEM RPL as is used by the USER RPL.
Once a key is pressed and the two system binaries are pushed to the stack, it
is then up to the SYSTEM RPL to make a decision base on the value of these
results as to what to do next (i.e. change menus, execute functions, initiate
the command line, etc.).
Interrupting the SYSTEM RPL responsible for interpreting and executing the
actual key stroke is easily done. It is then possible to substitute a user
scheme to effectively handle the task of key press management, but this is no
small job, and the process can become quite lengthy. All details regarding
the interrupt mechanism and the SYSTEM RPL management of key presses will not
be addresses here as I'm saving it for the August conference. What will be
covered here is involved enough for now, and should be more than adequate for
the majority of users. In other words, I'm providing all the support tools
necessary for interrupting the 48's hard key assignments. Keeping it in mind
that this has nothing to do with the user key assignments as I have gone to
great lengths to maintain the integrity of this feature that actually coexists
with the regular key assignments.
The two directories at the end of this article are suitable for converting
to library format. The first will be primarily of interest to those concerned
with hard addressing key assignments in software intended for ROM cards, and
the second for those who wish to perform interrupts from RAM. Although I have
tried to stick to entry points supported by Hewlett-Packard, it wasn't always
possible to do so. I apologize for this, especially to those who haven't spent
the majority of their spare time for the past two years peeking at the hex in
the HP28/48. So with all that said, let's get started.
o Hard key assignments in the 48 are found in the hidden ROM
and packaged in an Array of System Binary data object that
contains forty nine System Binary elements. Each of these
elements is in fact the address of another Array of System
Binary within the hidden ROM containing six elements which
are the addresses of the various key configurations that a
particular key is assigned. Each element corresponds to a
specific key-shift pattern as follows:
1st element: unshifted
2nd element: left-shifted
3rd element: right-shifted
4th element: alpha-shifted
5th element: alpha-left-shifted
6th element: alpha-right-shifted
o The key assignment array in an HP48 version E is located at
# 7B4E4h in the covered ROM. While it is not necessary for
this to be done, the Array of System Binary can be recalled
by using \<< #3FB1Fh SYSEVAL #C612h SYSEVAL \>>. Implement
OUT\-> to decompose the array into its individual elements.
The first element in this array of forty nine elements is a
System Binary that is the address of an array of six System
Binaries that are the addresses of each of the six specific
key-shift patterns for the upper most left-hand key. So to
continue associating each of the forty nine elements with a
particular key, simply move from left to right, assigning a
new element for each one of the 48's keys. This means that
the upper most right-hand key is the sixth element, and the
lower most right-hand is the forty ninth array element.
CORRESPONDING KEYBOARD ARRAY ELEMENTS
[ A ] [ B ] [ C ] [ D ] [ E ] [ F ]
<7AA5Dh> <7AA94h> <7AACBh> <7AB02h> <7AB39h> <7AB70h>
[MTH] [PRG] [CST] [VAR] [ ^ ] [NXT]
<7ABA7h> <7ABDEh> <7AC15h> <7AC4Ch> <7AC83h> <7ACBAh>
[ ' ] [STO] [EVAL] [ < ] [ v ] [ > ]
<7ACF1h> <7AD28h> <7AD5Fh> <7AD96h> <7ADCDh> <7AE04h>
[SIN] [COS] [TAN] [SQx] [pwr] [1/x]
<7AE3Bh> <7AE72h> <7AEA9h> <7AEE0h> <7AF17h> <7AF4Eh>
[ENTER] [+/-] [EEX] [DEL] [<==]
<7AF85h> <7AFBCh> <7AFF3h> <7B02Ah> <7B061h>
[alpha] [ 7 ] [ 8 ] [ 9 ] [ / ]
<7B098h> <7B0CFh> <7B106h> <7B13Dh> <7B174h>
[left] [ 4 ] [ 5 ] [ 6 ] [ * ]
<7B1ABh> <7B1E2h> <7B219h> <7B250h> <7B287h>
[right] [ 1 ] [ 2 ] [ 3 ] [ - ]
<7B2BEh> <7B2F5h> <7B32Ch> <7B363h> <7B39Ah>
[ ON ] [ 0 ] [ . ] [SPC] [ + ]
<7B3D1h> <7B408h> <7B43Fh> <7B476h> <7B4ADh>
o Key reassignments are made by replacing array elements that
correspond to the appropriate keys. Utilizing the provided
shareware, this is accomplished through the modification of
the Array of System Binary stored in the KEYS variable from
directory number one, or the Array of Global Name stored in
the KEYS variable, but in directory number two instead. In
addition directory two contains forty nine Global variables
sequentially named beginning with K.1 through K.49. Stored
in each of these is an Array of System Binary corresponding
to the key number from which individual variable names were
derived. Therefore, the Global name K.1 contains the Array
of System Binary recovered from the hidden ROM at # 7AA5Dh.
o The Array of System Binary stored in the KEYS variable from
directory one is the cache for the default key assignments.
This is because it's easiest to begin customizing hard keys
by altering the default assignments rather than building an
array from scratch. The scheme used by the first directory
to override the default key assignments is quite similar to
that of the one found in the 48. An Array of System Binary
is the only type of array that is allowed, and each element
must be an address in memory where a second Array of System
Binary is located whose elements are the addresses of entry
points for the various key configurations associated with a
specific key. This requires knowing the location in memory
where the arrays are stored and that once these assignments
are made they cannot be moved. Clearly this application is
better suited for software that is hard addressed. However
there are applications for RAM oriented software exploiting
this scheme. For example it might be desirable to reassign
the hard keys differently from the factory's. For instance
it would be more convenient for the top row of menu keys to
be closer to the numerical keys for someone who was working
with hexadecimal integers. A third directory included here
is identical to the first but with one exception; the Array
of System Binary has had its elements rearranged so the top
row of keys has been exchanged with forth row. This brings
the alpha keys A through F closer to the numerical keys for
quicker access. Implementing CUSTOM swaps row one and four
and DEFAULT restores them to their factory assignments.
o The second directory provides the flexibility necessary for
software intended to be used in RAM. Mainly this is due to
an embellished CUSTOM function which permits two additional
types of arrays to be used. These additional types include
the previously mention Array of Global Name, as well as its
library counterpart Array of XLIB Name. Where the Array of
Global Name stored in the KEYS variable contains all of the
forty nine sequentially named Global variables. This means
that the routine can now find arrays stored in Global Names
or XLIBs as well as by their memory locations. Furthermore
the secondary arrays that house the individual key patterns
may also be composed of either Global Names or XLIBs. This
allows user defined functions to be assigned to keys either
by their Global Names or XLIBs.
o Reassign a key to functions stored in Global Names or XLIBs
by constructing an array of Global Names or XLIBs using the
->ARR command from HACKIT and then storing it in any one or
more of the forty nine sequentially named global variables.
Once this is done implement the CUSTOM function in order to
interrupt the default key assignments. Restore the default
key assignments using the DEFAULT function.
Example: Assign the first menu page of the HACKIT
library to a single key of your choice.
_________________________ _________________________
|{HOME} | |{HOME} |
|-----------------------| |-----------------------|
|3: | |4: |
|2: | |3: |
|1: { ->ASCI ASCI-> SCRC| |2: |
| SEEK PEEK POKE } | |1: Array of XLIB Name|
|### ### ### ### ### ###| |### ### ### ### ### ###|
------------------------- -------------------------
1) Place the six commands from 2) Implement OUT-> to explode
the first page of HACKIT in the list and then ->ARR to
a list then enter it on the obtain the array. Storing
on the stack in level one. it in any K.n assigns that
(Display model is not exact.) key the six library XLIBs.
o These directories effectively permit user defined functions
to be assigned to keys without utilization of the USER MODE
which is still available for regular use. Essentially this
routine doubles the amount of possible user key assignments
previously available. Extensive measures were taken not to
restrict user applications, meaning the scheme has not been
one hundred percent idiot-proofed. Two specific areas that
could be potentially dangerous are as follows:
+ Do not store any objects other than arrays
in the sequentially named Global variables
because a decision was made to eval rather
than rcl the elements from the KEYS array.
+ Avoid using subdirectories for this scheme
because moving up to a parent directory or
the HOME directory without first restoring
control to the default could perhaps cause
a memory loss.
One final note; if either of these two directories are to be
converted to libraries it would be advisable to place all of
variables other than CUSTOM and DEFAULT in a list in $HIDDEN
in order to hide them in the library. This is because these
two variables are the only ones necessary for the control of
the scheme once the key assignments have actually been made.
Note that STDKEYS is an RPL subroutine called by CUSTOM. Do
not implement it for any reason. Both uuencode and ASC have
been provided.